package model;

public class Order { // 订单类 完成人:姜凯严 6/30
    private int orderId;
    private int userId;
    private int redWineId;
    private int quantity;
    private OrderStatus status; 
    private boolean online; 
    private int code; // 标识码

    public enum OrderStatus {
        未付款, 已付款, 待收货, 已完成
    }

    // 构造方法、getter和setter
    public Order() {}

    public Order(int orderId, int userId, int redWineId, int quantity, OrderStatus status, boolean online, int code) {
        this.orderId = orderId;
        this.userId = userId;
        this.redWineId = redWineId;
        this.quantity = quantity;
        this.status = status;
        this.online = online;
        this.code = code;
    }

    // 兼容旧构造方法（可选）
    public Order(int orderId, int userId, int redWineId, int quantity, String status, boolean online, int code) {
        this(orderId, userId, redWineId, quantity, OrderStatus.valueOf(status), online, code);
    }

    public int getOrderId() { return orderId; }
    public void setOrderId(int orderId) { this.orderId = orderId; }

    public int getUserId() { return userId; }
    public void setUserId(int userId) { this.userId = userId; }

    public int getRedWineId() { return redWineId; }
    public void setRedWineId(int redWineId) { this.redWineId = redWineId; }

    public int getQuantity() { return quantity; }
    public void setQuantity(int quantity) { this.quantity = quantity; }

    public OrderStatus getStatus() { return status; }
    public void setStatus(OrderStatus status) { this.status = status; }
    public void setStatus(String status) { this.status = OrderStatus.valueOf(status); }

    public boolean isOnline() { return online; }
    public void setOnline(boolean online) { this.online = online; }

    public int getCode() { return code; }
    public void setCode(int code) { this.code = code; }
}
